T = int(raw_input())
for i in range(T):
    N = int(raw_input())
    l1 = list([c for c in raw_input()])
    for j in range(N-1):
        l2 = []
        for c in raw_input():
            if(c in l1):
                l1.remove(c)
                l2.append(c)
        l1 = l2
    l1.sort()
    print ''.join(l1)